package com.wc.alorithm_blue_bridge._排序.三国游戏;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2025/3/5 7:48
 * @description
 * https://www.lanqiao.cn/courses/46292/learning/?id=3436968&compatibility=false
 */
public class Main {
    /**
     * w[i] = a[i] - b[i] - c[i], 倒叙排列, w[i] > 0 的前缀和 > 0,就可以放生
     */
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 100010;
    static long[] a = new long[N], b = new long[N], c = new long[N], w = new long[N];
    static int n;

    public static void main(String[] args) {
        n = sc.nextInt();
        for (int i = 1; i <= n; i++) a[i] = sc.nextInt();
        for (int i = 1; i <= n; i++) b[i] = sc.nextInt();
        for (int i = 1; i <= n; i++) c[i] = sc.nextInt();
        int res = work(a, b, c);
        res = Math.max(res, work(b, a, c));
        res = Math.max(res, work(c, a, b));
        out.println(res);
        out.flush();
    }

    static int work(long[] a, long[] b, long[] c) {
        for (int i = 1; i <= n; i++) w[i] = a[i] - b[i] - c[i];
        Arrays.sort(w, 1, n + 1);
        int res = -1;
        long sum = 0;
        for (int i = n; i >= 1; i--) {
            sum += w[i];
            if (sum > 0) res = n - i + 1;
            else break;
        }

        return res;
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}

